using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using BTOps;

public partial class ValidationOps_Default : System.Web.UI.Page
{
    private string selectedSchemas = String.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            pnlSchemaList.Visible = true;
            chkAll.Attributes.Add("onclick", "return CheckBoxListSelect('" + chkSchemas.ClientID + "', this.checked);");
        }
    }

    protected void chkSchemas_SelectedIndexChanged(object sender, EventArgs e)
    {
        CheckBoxList chkList = (CheckBoxList)sender;

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < chkList.Items.Count; i++)
        {
            if (chkList.Items[i].Selected)
            {
                sb.Append(chkList.Items[i].Value);
                if (sb.Length > 0)
                    sb.Append("|");
            }
        }

        selectedSchemas = sb.ToString();
    }

    private bool ValidateDoc()
    {
        string[] schemas = selectedSchemas.Split(new char[] {'|'});
        Operations btOps = new Operations();
        foreach (string schemaName in schemas)
        {
            BTSchema[] schemasByName = btOps.Schemas(ddlApps.SelectedValue, schemaName);
            foreach (BTSchema schema in schemasByName)
            {
                XmlReader reader = XmlReader.Create("");
            }
        }
        return false;
    }
    protected void btnValidate_Click(object sender, EventArgs e)
    {
        ValidateDoc();
    }
}
